﻿import de.back2dos.as24x.xXML;
class Main {
	public static function main(swfRoot:MovieClip):Void {
		xXML.fromURL("test.xml", go);		
	}
	private static function go(x:xXML):Void {		
		//let's try attributes
		trace(x.$bar);//"bar" - wahoooo 
		trace(x.set$bar(123));//123 - quite as expected
		trace(x.$bar);//123 - it really is!!!
		
		//let's go with lists
		trace(x.bar.length);//3 - seems to work
		
		//now some filtering 
		
			//set up a filter function
			var filter:Function = function (node:xXML):Boolean { return node.$name == "test" };
			trace(x.children.filter(filter).length);//3 - works fine
			
			//now let's see, if we can access attributes of 1-child lists
			trace(x.foobar.set$name("asd"));//asd - yup
			trace(x.children.filter(filter).length);//2 - seems to have worked ... luckily
	}
}